package com.hdu.clj.dncard.database

import android.content.Context
import android.database.sqlite.SQLiteDatabase
import android.database.sqlite.SQLiteOpenHelper
import android.util.Log

class HeroDatabase(val context: Context, name:String, version:Int, user:String): SQLiteOpenHelper(context,name,null,version) {

    private val tableName = "abc" + user

    private val HeroBook = "create table Hero(" +
            "id integer primary key autoincrement," +
            "hid text," +
            "acc text," +
            "attack integer," +
            "defence integer," +
            "wisdom integer," +
            "life integer," +
            "equipment text)"

    override fun onCreate(db: SQLiteDatabase) {
        db.execSQL(HeroBook)
        Log.d("curdata","create hero")
    }

    override fun onUpgrade(db: SQLiteDatabase, oldVersion: Int, newVersion: Int) {
//        db.execSQL(dayNumBook)
//        db.execSQL("drop table if exists $tableName")
//        onCreate(db)
    }
}